<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ attribute name="content" type="java.lang.String" required="true" description="消息内容"%>
<%@ attribute name="type" type="java.lang.String" description="消息类型：info、success、warning、error、loading"%>
<%@ attribute name="onTip" type="java.lang.String" description="是否显示tip 默认显示"%>
<%@ attribute name="onMessage" type="java.lang.String" description="是否显示message 默认显示"%>

<script type="text/javascript">top.$.jBox.closeTip();</script>
<% System.out.println(content);  %>
<c:if test="${not empty content}">
    <c:if test="${empty onTip}">
        <c:set value="true" var="onTip"/>
    </c:if>
    <c:if test="${empty onMessage}">
        <c:set value="true" var="onMessage"/>
    </c:if>
	<c:if test="${not empty type}">
        <c:set var="ctype" value="${type}"/>
    </c:if>
    <c:if test="${empty type}">
        <c:set var="ctype" value="${fn:indexOf(content,'失败') eq -1?'success':'error'}"/>
    </c:if>
    <!--初始化参数片段-->
    <c:if test="${onMessage eq 'true'}">
	    <div id="messageBox" class="alert alert-${ctype} hide"><button data-dismiss="alert" class="close">×</button>${content}</div>
    </c:if>
    <script type="text/javascript">
		if(!top.$.jBox.tip.mess){
			top.$.jBox.tip.mess=1;
            var onTip = '${onTip}';
            if(onTip=="true"){
                top.$.jBox.tip("${content}",
                               "${ctype}",
                               {persistent:true,opacity:0}
                );
            }
            var onMessage = '${onMessage}';
            if(onMessage=="true"){
                $("#messageBox").show();
            }
		}
	</script>
</c:if>